<?php

namespace app\admin\controller;

use app\admin\service\Rbac;
use think\facade\Session;

class Index extends Base
{
    public function index()
    {
        return view('index');
    }

    public function logout()
    {
        // 删除登录session_admin_id
//        Session::delete('session_admin_id');
        $userId = Session::get('session_admin_id');
        // 清空session
        Session::clear();
        // 删除登录缓存
        $rbac = new Rbac();
        $rbac->delCache($userId);
        return redirect('login/index');
    }
}
